<?php

/**
 * API公用方法
 */
trait Trait_Api_Common
{
    /**
     * 添加订单游客
     * @param $tourists
     * @param $order_id
     * @return void
     * @throws Kohana_Exception
     */
    public function add_order_tourer($order_id, $tourists)
    {
        if ($tourists && is_array($tourists)) {
            foreach ($tourists as $v) {
                $arr = array(
                    'orderid' => $order_id,
                    'tourername' => $v['tourername'],
                    'sex' => $v['sex'],
                    'mobile' => $v['mobile'],
                    'cardtype' => $v['cardtype'],
                    'cardnumber' => $v['cardnumber'],
                    'en_first_name' => $v['en_first_name'],
                    'en_last_name' => $v['en_last_name'],
                    'nationality' => $v['nationality'],
                    'cardnumber_expire_date' => $v['cardnumber_expire_date'],
                    'birth' => $v['birth'],
                );
                DB::insert('member_order_tourer', array_keys($arr))->values(array_values($arr))->execute();
            }
        }
    }


}